import request from '@/utils/request'

//获取食物列表
export const getFoodListService = ({ page, pageSize,name }) => {
  return request.get('/food/page', {
    params: {
      page: page,
      pageSize: pageSize,
      name:name
    }
  })
}

//改变食物状态
export const editFoodStatusService = (data) => {
  return request.post(`/food/status/${data.status}`, null, {
    params: {
      ids: data.ids // 这里的data.ids应该是一个数组
    }
  })
}

//删除食物
export const deleteFoodService = (ids) => {
  return request.delete('/food', {
    params: {
      ids: ids
    }
  })
}

//修改食物
export const updateFoodService = (data) => {
  return request.put('/food', data)
}

//根据食物id得到详细数据
export const getFoodById = ({ id }) => {
  return request.get(`/food/${id}`)
}
